blob: b643704c4062947f9985e5c3463781981d1a25d9 [file] [log] [blame]
Junio C Hamano3dac5042007-12-15 08:40:541<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4<head>
Junio C Hamano9d971152012-12-19 00:43:115<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
6<meta name="generator" content="AsciiDoc 8.6.8" />
Junio C Hamano103b5722011-01-31 05:03:457<title>tree walking API</title>
Junio C Hamano3dac5042007-12-15 08:40:548<style type="text/css">
Junio C Hamano9d971152012-12-19 00:43:119/* Shared CSS for AsciiDoc xhtml11 and html5 backends */
10
11/* Default font. */
12body {
13 font-family: Georgia,serif;
14}
15
16/* Title font. */
17h1, h2, h3, h4, h5, h6,
18div.title, caption.title,
19thead, p.table.header,
20#toctitle,
21#author, #revnumber, #revdate, #revremark,
22#footer {
23 font-family: Arial,Helvetica,sans-serif;
Junio C Hamano3dac5042007-12-15 08:40:5424}
25
26body {
27 margin: 1em 5% 1em 5%;
28}
29
Junio C Hamano4604fe52008-09-19 06:37:1030a {
31 color: blue;
32 text-decoration: underline;
33}
34a:visited {
35 color: fuchsia;
36}
Junio C Hamano3dac5042007-12-15 08:40:5437
38em {
39 font-style: italic;
Junio C Hamano103b5722011-01-31 05:03:4540 color: navy;
Junio C Hamano3dac5042007-12-15 08:40:5441}
42
43strong {
44 font-weight: bold;
Junio C Hamano103b5722011-01-31 05:03:4545 color: #083194;
Junio C Hamano3dac5042007-12-15 08:40:5446}
47
Junio C Hamano3dac5042007-12-15 08:40:5448h1, h2, h3, h4, h5, h6 {
49 color: #527bbd;
Junio C Hamano3dac5042007-12-15 08:40:5450 margin-top: 1.2em;
51 margin-bottom: 0.5em;
52 line-height: 1.3;
53}
54
Junio C Hamano4604fe52008-09-19 06:37:1055h1, h2, h3 {
Junio C Hamano3dac5042007-12-15 08:40:5456 border-bottom: 2px solid silver;
57}
58h2 {
Junio C Hamano3dac5042007-12-15 08:40:5459 padding-top: 0.5em;
60}
Junio C Hamano4604fe52008-09-19 06:37:1061h3 {
62 float: left;
63}
64h3 + * {
65 clear: left;
66}
Junio C Hamano9d971152012-12-19 00:43:1167h5 {
68 font-size: 1.0em;
69}
Junio C Hamano3dac5042007-12-15 08:40:5470
71div.sectionbody {
Junio C Hamano3dac5042007-12-15 08:40:5472 margin-left: 0;
73}
74
75hr {
76 border: 1px solid silver;
77}
78
79p {
80 margin-top: 0.5em;
81 margin-bottom: 0.5em;
82}
83
Junio C Hamano103b5722011-01-31 05:03:4584ul, ol, li > p {
85 margin-top: 0;
86}
Junio C Hamano9d971152012-12-19 00:43:1187ul > li { color: #aaa; }
88ul > li > * { color: black; }
Junio C Hamano103b5722011-01-31 05:03:4589
Junio C Hamano9d971152012-12-19 00:43:1190.monospaced, code, pre {
91 font-family: "Courier New", Courier, monospace;
92 font-size: inherit;
93 color: navy;
Junio C Hamano3dac5042007-12-15 08:40:5494 padding: 0;
95 margin: 0;
96}
97
Junio C Hamano9d971152012-12-19 00:43:1198
99#author {
Junio C Hamano3dac5042007-12-15 08:40:54100 color: #527bbd;
Junio C Hamano3dac5042007-12-15 08:40:54101 font-weight: bold;
Junio C Hamano4604fe52008-09-19 06:37:10102 font-size: 1.1em;
Junio C Hamano3dac5042007-12-15 08:40:54103}
Junio C Hamano9d971152012-12-19 00:43:11104#email {
Junio C Hamano3dac5042007-12-15 08:40:54105}
Junio C Hamano9d971152012-12-19 00:43:11106#revnumber, #revdate, #revremark {
Junio C Hamano3dac5042007-12-15 08:40:54107}
108
Junio C Hamano9d971152012-12-19 00:43:11109#footer {
Junio C Hamano3dac5042007-12-15 08:40:54110 font-size: small;
111 border-top: 2px solid silver;
112 padding-top: 0.5em;
113 margin-top: 4.0em;
114}
Junio C Hamano9d971152012-12-19 00:43:11115#footer-text {
Junio C Hamano3dac5042007-12-15 08:40:54116 float: left;
117 padding-bottom: 0.5em;
118}
Junio C Hamano9d971152012-12-19 00:43:11119#footer-badges {
Junio C Hamano3dac5042007-12-15 08:40:54120 float: right;
121 padding-bottom: 0.5em;
122}
123
Junio C Hamano9d971152012-12-19 00:43:11124#preamble {
Junio C Hamano103b5722011-01-31 05:03:45125 margin-top: 1.5em;
126 margin-bottom: 1.5em;
127}
Junio C Hamano9d971152012-12-19 00:43:11128div.imageblock, div.exampleblock, div.verseblock,
Junio C Hamano3dac5042007-12-15 08:40:54129div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
130div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22131 margin-top: 1.0em;
Junio C Hamano3dac5042007-12-15 08:40:54132 margin-bottom: 1.5em;
133}
134div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22135 margin-top: 2.0em;
136 margin-bottom: 2.0em;
137 margin-right: 10%;
138 color: #606060;
Junio C Hamano3dac5042007-12-15 08:40:54139}
140
141div.content { /* Block element content. */
142 padding: 0;
143}
144
145/* Block element titles. */
146div.title, caption.title {
Junio C Hamano103b5722011-01-31 05:03:45147 color: #527bbd;
Junio C Hamano3dac5042007-12-15 08:40:54148 font-weight: bold;
149 text-align: left;
150 margin-top: 1.0em;
151 margin-bottom: 0.5em;
152}
153div.title + * {
154 margin-top: 0;
155}
156
157td div.title:first-child {
158 margin-top: 0.0em;
159}
160div.content div.title:first-child {
161 margin-top: 0.0em;
162}
163div.content + div.title {
164 margin-top: 0.0em;
165}
166
167div.sidebarblock > div.content {
168 background: #ffffee;
Junio C Hamano9d971152012-12-19 00:43:11169 border: 1px solid #dddddd;
170 border-left: 4px solid #f0f0f0;
Junio C Hamano3dac5042007-12-15 08:40:54171 padding: 0.5em;
172}
173
174div.listingblock > div.content {
Junio C Hamano9d971152012-12-19 00:43:11175 border: 1px solid #dddddd;
176 border-left: 5px solid #f0f0f0;
177 background: #f8f8f8;
Junio C Hamano3dac5042007-12-15 08:40:54178 padding: 0.5em;
179}
180
Junio C Hamano7bd050f2011-09-22 06:32:22181div.quoteblock, div.verseblock {
182 padding-left: 1.0em;
183 margin-left: 1.0em;
Junio C Hamano103b5722011-01-31 05:03:45184 margin-right: 10%;
Junio C Hamano9d971152012-12-19 00:43:11185 border-left: 5px solid #f0f0f0;
186 color: #888;
Junio C Hamano3dac5042007-12-15 08:40:54187}
Junio C Hamano7bd050f2011-09-22 06:32:22188
Junio C Hamano103b5722011-01-31 05:03:45189div.quoteblock > div.attribution {
190 padding-top: 0.5em;
Junio C Hamano3dac5042007-12-15 08:40:54191 text-align: right;
192}
Junio C Hamano103b5722011-01-31 05:03:45193
Junio C Hamano9d971152012-12-19 00:43:11194div.verseblock > pre.content {
195 font-family: inherit;
196 font-size: inherit;
Junio C Hamano103b5722011-01-31 05:03:45197}
198div.verseblock > div.attribution {
199 padding-top: 0.75em;
200 text-align: left;
201}
202/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
Junio C Hamano4604fe52008-09-19 06:37:10203div.verseblock + div.attribution {
204 text-align: left;
205}
Junio C Hamano3dac5042007-12-15 08:40:54206
207div.admonitionblock .icon {
208 vertical-align: top;
209 font-size: 1.1em;
210 font-weight: bold;
211 text-decoration: underline;
212 color: #527bbd;
213 padding-right: 0.5em;
214}
215div.admonitionblock td.content {
216 padding-left: 0.5em;
Junio C Hamano7bd050f2011-09-22 06:32:22217 border-left: 3px solid #dddddd;
Junio C Hamano3dac5042007-12-15 08:40:54218}
219
220div.exampleblock > div.content {
Junio C Hamano7bd050f2011-09-22 06:32:22221 border-left: 3px solid #dddddd;
222 padding-left: 0.5em;
Junio C Hamano3dac5042007-12-15 08:40:54223}
224
Junio C Hamano3dac5042007-12-15 08:40:54225div.imageblock div.content { padding-left: 0; }
Junio C Hamano3dac5042007-12-15 08:40:54226span.image img { border-style: none; }
Junio C Hamano103b5722011-01-31 05:03:45227a.image:visited { color: white; }
Junio C Hamano3dac5042007-12-15 08:40:54228
229dl {
230 margin-top: 0.8em;
231 margin-bottom: 0.8em;
232}
233dt {
234 margin-top: 0.5em;
235 margin-bottom: 0;
Junio C Hamano103b5722011-01-31 05:03:45236 font-style: normal;
237 color: navy;
Junio C Hamano3dac5042007-12-15 08:40:54238}
239dd > *:first-child {
Junio C Hamano103b5722011-01-31 05:03:45240 margin-top: 0.1em;
Junio C Hamano3dac5042007-12-15 08:40:54241}
242
243ul, ol {
244 list-style-position: outside;
245}
Junio C Hamano103b5722011-01-31 05:03:45246ol.arabic {
247 list-style-type: decimal;
248}
249ol.loweralpha {
Junio C Hamano3dac5042007-12-15 08:40:54250 list-style-type: lower-alpha;
251}
Junio C Hamano103b5722011-01-31 05:03:45252ol.upperalpha {
253 list-style-type: upper-alpha;
254}
255ol.lowerroman {
256 list-style-type: lower-roman;
257}
258ol.upperroman {
259 list-style-type: upper-roman;
260}
261
262div.compact ul, div.compact ol,
263div.compact p, div.compact p,
264div.compact div, div.compact div {
265 margin-top: 0.1em;
266 margin-bottom: 0.1em;
267}
Junio C Hamano3dac5042007-12-15 08:40:54268
Junio C Hamano3dac5042007-12-15 08:40:54269tfoot {
270 font-weight: bold;
271}
Junio C Hamano103b5722011-01-31 05:03:45272td > div.verse {
273 white-space: pre;
274}
Junio C Hamano103b5722011-01-31 05:03:45275
276div.hdlist {
Junio C Hamano3dac5042007-12-15 08:40:54277 margin-top: 0.8em;
278 margin-bottom: 0.8em;
279}
Junio C Hamano103b5722011-01-31 05:03:45280div.hdlist tr {
281 padding-bottom: 15px;
Junio C Hamano4604fe52008-09-19 06:37:10282}
Junio C Hamano103b5722011-01-31 05:03:45283dt.hdlist1.strong, td.hdlist1.strong {
284 font-weight: bold;
285}
286td.hdlist1 {
Junio C Hamano3dac5042007-12-15 08:40:54287 vertical-align: top;
Junio C Hamano103b5722011-01-31 05:03:45288 font-style: normal;
Junio C Hamano3dac5042007-12-15 08:40:54289 padding-right: 0.8em;
Junio C Hamano103b5722011-01-31 05:03:45290 color: navy;
Junio C Hamano3dac5042007-12-15 08:40:54291}
Junio C Hamano103b5722011-01-31 05:03:45292td.hdlist2 {
Junio C Hamano3dac5042007-12-15 08:40:54293 vertical-align: top;
294}
Junio C Hamano103b5722011-01-31 05:03:45295div.hdlist.compact tr {
296 margin: 0;
297 padding-bottom: 0;
298}
299
300.comment {
301 background: yellow;
302}
Junio C Hamano3dac5042007-12-15 08:40:54303
Junio C Hamano7bd050f2011-09-22 06:32:22304.footnote, .footnoteref {
305 font-size: 0.8em;
306}
307
308span.footnote, span.footnoteref {
309 vertical-align: super;
310}
311
312#footnotes {
313 margin: 20px 0 20px 0;
314 padding: 7px 0 0 0;
315}
316
317#footnotes div.footnote {
318 margin: 0 0 5px 0;
319}
320
321#footnotes hr {
322 border: none;
323 border-top: 1px solid silver;
324 height: 1px;
325 text-align: left;
326 margin-left: 0;
327 width: 20%;
328 min-width: 100px;
329}
330
Junio C Hamano9d971152012-12-19 00:43:11331div.colist td {
332 padding-right: 0.5em;
333 padding-bottom: 0.3em;
334 vertical-align: top;
335}
336div.colist td img {
337 margin-top: 0.3em;
Junio C Hamano3dac5042007-12-15 08:40:54338}
Junio C Hamano4604fe52008-09-19 06:37:10339
Junio C Hamano9d971152012-12-19 00:43:11340@media print {
341 #footer-badges { display: none; }
342}
343
344#toc {
Junio C Hamano7bd050f2011-09-22 06:32:22345 margin-bottom: 2.5em;
346}
347
Junio C Hamano9d971152012-12-19 00:43:11348#toctitle {
Junio C Hamano4604fe52008-09-19 06:37:10349 color: #527bbd;
Junio C Hamano4604fe52008-09-19 06:37:10350 font-size: 1.1em;
351 font-weight: bold;
352 margin-top: 1.0em;
353 margin-bottom: 0.1em;
354}
355
Junio C Hamano9d971152012-12-19 00:43:11356div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
Junio C Hamano4604fe52008-09-19 06:37:10357 margin-top: 0;
358 margin-bottom: 0;
359}
360div.toclevel2 {
361 margin-left: 2em;
362 font-size: 0.9em;
363}
364div.toclevel3 {
365 margin-left: 4em;
366 font-size: 0.9em;
367}
368div.toclevel4 {
369 margin-left: 6em;
370 font-size: 0.9em;
371}
Junio C Hamano3dac5042007-12-15 08:40:54372
Junio C Hamano9d971152012-12-19 00:43:11373span.aqua { color: aqua; }
374span.black { color: black; }
375span.blue { color: blue; }
376span.fuchsia { color: fuchsia; }
377span.gray { color: gray; }
378span.green { color: green; }
379span.lime { color: lime; }
380span.maroon { color: maroon; }
381span.navy { color: navy; }
382span.olive { color: olive; }
383span.purple { color: purple; }
384span.red { color: red; }
385span.silver { color: silver; }
386span.teal { color: teal; }
387span.white { color: white; }
388span.yellow { color: yellow; }
389
390span.aqua-background { background: aqua; }
391span.black-background { background: black; }
392span.blue-background { background: blue; }
393span.fuchsia-background { background: fuchsia; }
394span.gray-background { background: gray; }
395span.green-background { background: green; }
396span.lime-background { background: lime; }
397span.maroon-background { background: maroon; }
398span.navy-background { background: navy; }
399span.olive-background { background: olive; }
400span.purple-background { background: purple; }
401span.red-background { background: red; }
402span.silver-background { background: silver; }
403span.teal-background { background: teal; }
404span.white-background { background: white; }
405span.yellow-background { background: yellow; }
406
407span.big { font-size: 2em; }
408span.small { font-size: 0.6em; }
409
410span.underline { text-decoration: underline; }
411span.overline { text-decoration: overline; }
412span.line-through { text-decoration: line-through; }
413
414div.unbreakable { page-break-inside: avoid; }
415
416
417/*
418 * xhtml11 specific
419 *
420 * */
421
422div.tableblock {
423 margin-top: 1.0em;
424 margin-bottom: 1.5em;
Junio C Hamano3dac5042007-12-15 08:40:54425}
Junio C Hamano9d971152012-12-19 00:43:11426div.tableblock > table {
427 border: 3px solid #527bbd;
428}
429thead, p.table.header {
Junio C Hamano3dac5042007-12-15 08:40:54430 font-weight: bold;
Junio C Hamano9d971152012-12-19 00:43:11431 color: #527bbd;
432}
433p.table {
434 margin-top: 0;
435}
436/* Because the table frame attribute is overriden by CSS in most browsers. */
437div.tableblock > table[frame="void"] {
438 border-style: none;
439}
440div.tableblock > table[frame="hsides"] {
441 border-left-style: none;
442 border-right-style: none;
443}
444div.tableblock > table[frame="vsides"] {
445 border-top-style: none;
446 border-bottom-style: none;
Junio C Hamano3dac5042007-12-15 08:40:54447}
448
Junio C Hamano9d971152012-12-19 00:43:11449
450/*
451 * html5 specific
452 *
453 * */
454
455table.tableblock {
456 margin-top: 1.0em;
457 margin-bottom: 1.5em;
458}
459thead, p.tableblock.header {
460 font-weight: bold;
461 color: #527bbd;
462}
463p.tableblock {
464 margin-top: 0;
465}
466table.tableblock {
467 border-width: 3px;
468 border-spacing: 0px;
469 border-style: solid;
470 border-color: #527bbd;
471 border-collapse: collapse;
472}
473th.tableblock, td.tableblock {
474 border-width: 1px;
475 padding: 4px;
476 border-style: solid;
477 border-color: #527bbd;
Junio C Hamano3dac5042007-12-15 08:40:54478}
479
Junio C Hamano9d971152012-12-19 00:43:11480table.tableblock.frame-topbot {
481 border-left-style: hidden;
482 border-right-style: hidden;
483}
484table.tableblock.frame-sides {
485 border-top-style: hidden;
486 border-bottom-style: hidden;
487}
488table.tableblock.frame-none {
489 border-style: hidden;
490}
491
492th.tableblock.halign-left, td.tableblock.halign-left {
493 text-align: left;
494}
495th.tableblock.halign-center, td.tableblock.halign-center {
496 text-align: center;
497}
498th.tableblock.halign-right, td.tableblock.halign-right {
Junio C Hamano103b5722011-01-31 05:03:45499 text-align: right;
500}
501
Junio C Hamano9d971152012-12-19 00:43:11502th.tableblock.valign-top, td.tableblock.valign-top {
503 vertical-align: top;
Junio C Hamano103b5722011-01-31 05:03:45504}
Junio C Hamano9d971152012-12-19 00:43:11505th.tableblock.valign-middle, td.tableblock.valign-middle {
506 vertical-align: middle;
507}
508th.tableblock.valign-bottom, td.tableblock.valign-bottom {
509 vertical-align: bottom;
Junio C Hamano3dac5042007-12-15 08:40:54510}
511
Junio C Hamano9d971152012-12-19 00:43:11512
513/*
514 * manpage specific
515 *
516 * */
517
518body.manpage h1 {
519 padding-top: 0.5em;
520 padding-bottom: 0.5em;
521 border-top: 2px solid silver;
522 border-bottom: 2px solid silver;
523}
524body.manpage h2 {
525 border-style: none;
526}
527body.manpage div.sectionbody {
528 margin-left: 3em;
Junio C Hamano3dac5042007-12-15 08:40:54529}
Junio C Hamano4604fe52008-09-19 06:37:10530
Junio C Hamano9d971152012-12-19 00:43:11531@media print {
532 body.manpage div#toc { display: none; }
533}
534
535
Junio C Hamano3dac5042007-12-15 08:40:54536</style>
Junio C Hamano7bd050f2011-09-22 06:32:22537<script type="text/javascript">
538/*<![CDATA[*/
Junio C Hamano7bd050f2011-09-22 06:32:22539var asciidoc = { // Namespace.
540
541/////////////////////////////////////////////////////////////////////
542// Table Of Contents generator
543/////////////////////////////////////////////////////////////////////
544
545/* Author: Mihai Bazon, September 2002
546 * http://students.infoiasi.ro/~mishoo
547 *
548 * Table Of Content generator
549 * Version: 0.4
550 *
551 * Feel free to use this script under the terms of the GNU General Public
552 * License, as long as you do not remove or alter this notice.
553 */
554
555 /* modified by Troy D. Hanson, September 2006. License: GPL */
556 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
557
558// toclevels = 1..4.
559toc: function (toclevels) {
560
561 function getText(el) {
562 var text = "";
563 for (var i = el.firstChild; i != null; i = i.nextSibling) {
564 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
565 text += i.data;
566 else if (i.firstChild != null)
567 text += getText(i);
568 }
569 return text;
570 }
571
572 function TocEntry(el, text, toclevel) {
573 this.element = el;
574 this.text = text;
575 this.toclevel = toclevel;
576 }
577
578 function tocEntries(el, toclevels) {
579 var result = new Array;
Junio C Hamano9d971152012-12-19 00:43:11580 var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
Junio C Hamano7bd050f2011-09-22 06:32:22581 // Function that scans the DOM tree for header elements (the DOM2
582 // nodeIterator API would be a better technique but not supported by all
583 // browsers).
584 var iterate = function (el) {
585 for (var i = el.firstChild; i != null; i = i.nextSibling) {
586 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
587 var mo = re.exec(i.tagName);
588 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
589 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
590 }
591 iterate(i);
592 }
593 }
594 }
595 iterate(el);
596 return result;
597 }
598
599 var toc = document.getElementById("toc");
Junio C Hamano9d971152012-12-19 00:43:11600 if (!toc) {
601 return;
602 }
603
604 // Delete existing TOC entries in case we're reloading the TOC.
605 var tocEntriesToRemove = [];
606 var i;
607 for (i = 0; i < toc.childNodes.length; i++) {
608 var entry = toc.childNodes[i];
609 if (entry.nodeName.toLowerCase() == 'div'
610 && entry.getAttribute("class")
611 && entry.getAttribute("class").match(/^toclevel/))
612 tocEntriesToRemove.push(entry);
613 }
614 for (i = 0; i < tocEntriesToRemove.length; i++) {
615 toc.removeChild(tocEntriesToRemove[i]);
616 }
617
618 // Rebuild TOC entries.
Junio C Hamano7bd050f2011-09-22 06:32:22619 var entries = tocEntries(document.getElementById("content"), toclevels);
620 for (var i = 0; i < entries.length; ++i) {
621 var entry = entries[i];
622 if (entry.element.id == "")
623 entry.element.id = "_toc_" + i;
624 var a = document.createElement("a");
625 a.href = "#" + entry.element.id;
626 a.appendChild(document.createTextNode(entry.text));
627 var div = document.createElement("div");
628 div.appendChild(a);
629 div.className = "toclevel" + entry.toclevel;
630 toc.appendChild(div);
631 }
632 if (entries.length == 0)
633 toc.parentNode.removeChild(toc);
634},
635
636
637/////////////////////////////////////////////////////////////////////
638// Footnotes generator
639/////////////////////////////////////////////////////////////////////
640
641/* Based on footnote generation code from:
642 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
643 */
644
645footnotes: function () {
Junio C Hamano9d971152012-12-19 00:43:11646 // Delete existing footnote entries in case we're reloading the footnodes.
647 var i;
Junio C Hamano7bd050f2011-09-22 06:32:22648 var noteholder = document.getElementById("footnotes");
Junio C Hamano9d971152012-12-19 00:43:11649 if (!noteholder) {
650 return;
651 }
652 var entriesToRemove = [];
653 for (i = 0; i < noteholder.childNodes.length; i++) {
654 var entry = noteholder.childNodes[i];
655 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
656 entriesToRemove.push(entry);
657 }
658 for (i = 0; i < entriesToRemove.length; i++) {
659 noteholder.removeChild(entriesToRemove[i]);
660 }
661
662 // Rebuild footnote entries.
663 var cont = document.getElementById("content");
Junio C Hamano7bd050f2011-09-22 06:32:22664 var spans = cont.getElementsByTagName("span");
665 var refs = {};
666 var n = 0;
667 for (i=0; i<spans.length; i++) {
668 if (spans[i].className == "footnote") {
669 n++;
Junio C Hamano9d971152012-12-19 00:43:11670 var note = spans[i].getAttribute("data-note");
671 if (!note) {
672 // Use [\s\S] in place of . so multi-line matches work.
673 // Because JavaScript has no s (dotall) regex flag.
674 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
675 spans[i].innerHTML =
676 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
677 "' title='View footnote' class='footnote'>" + n + "</a>]";
678 spans[i].setAttribute("data-note", note);
679 }
Junio C Hamano7bd050f2011-09-22 06:32:22680 noteholder.innerHTML +=
681 "<div class='footnote' id='_footnote_" + n + "'>" +
682 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
683 n + "</a>. " + note + "</div>";
Junio C Hamano7bd050f2011-09-22 06:32:22684 var id =spans[i].getAttribute("id");
685 if (id != null) refs["#"+id] = n;
686 }
687 }
688 if (n == 0)
689 noteholder.parentNode.removeChild(noteholder);
690 else {
691 // Process footnoterefs.
692 for (i=0; i<spans.length; i++) {
693 if (spans[i].className == "footnoteref") {
694 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
695 href = href.match(/#.*/)[0]; // Because IE return full URL.
696 n = refs[href];
697 spans[i].innerHTML =
698 "[<a href='#_footnote_" + n +
699 "' title='View footnote' class='footnote'>" + n + "</a>]";
700 }
701 }
702 }
Junio C Hamano9d971152012-12-19 00:43:11703},
704
705install: function(toclevels) {
706 var timerId;
707
708 function reinstall() {
709 asciidoc.footnotes();
710 if (toclevels) {
711 asciidoc.toc(toclevels);
712 }
713 }
714
715 function reinstallAndRemoveTimer() {
716 clearInterval(timerId);
717 reinstall();
718 }
719
720 timerId = setInterval(reinstall, 500);
721 if (document.addEventListener)
722 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
723 else
724 window.onload = reinstallAndRemoveTimer;
Junio C Hamano7bd050f2011-09-22 06:32:22725}
726
727}
Junio C Hamano9d971152012-12-19 00:43:11728asciidoc.install();
Junio C Hamano7bd050f2011-09-22 06:32:22729/*]]>*/
730</script>
Junio C Hamano3dac5042007-12-15 08:40:54731</head>
Junio C Hamano9d971152012-12-19 00:43:11732<body class="article">
Junio C Hamano3dac5042007-12-15 08:40:54733<div id="header">
734<h1>tree walking API</h1>
735</div>
Junio C Hamano7bd050f2011-09-22 06:32:22736<div id="content">
Junio C Hamano3dac5042007-12-15 08:40:54737<div id="preamble">
738<div class="sectionbody">
Junio C Hamano103b5722011-01-31 05:03:45739<div class="paragraph"><p>The tree walking API is used to traverse and inspect trees.</p></div>
Junio C Hamanofd9274d2009-08-05 21:21:39740</div>
741</div>
Junio C Hamano9d971152012-12-19 00:43:11742<div class="sect1">
Junio C Hamanofd9274d2009-08-05 21:21:39743<h2 id="_data_structures">Data Structures</h2>
744<div class="sectionbody">
Junio C Hamano103b5722011-01-31 05:03:45745<div class="dlist"><dl>
746<dt class="hdlist1">
Junio C Hamano9d971152012-12-19 00:43:11747<code>struct name_entry</code>
Junio C Hamanofd9274d2009-08-05 21:21:39748</dt>
749<dd>
750<p>
751 An entry in a tree. Each entry has a sha1 identifier, pathname, and
752 mode.
753</p>
754</dd>
Junio C Hamano103b5722011-01-31 05:03:45755<dt class="hdlist1">
Junio C Hamano9d971152012-12-19 00:43:11756<code>struct tree_desc</code>
Junio C Hamanofd9274d2009-08-05 21:21:39757</dt>
758<dd>
759<p>
760 A semi-opaque data structure used to maintain the current state of the
761 walk.
762</p>
Junio C Hamano103b5722011-01-31 05:03:45763<div class="ulist"><ul>
Junio C Hamano3dac5042007-12-15 08:40:54764<li>
765<p>
Junio C Hamano9d971152012-12-19 00:43:11766<code>buffer</code> is a pointer into the memory representation of the tree. It always
Junio C Hamanofd9274d2009-08-05 21:21:39767points at the current entry being visited.
Junio C Hamano3dac5042007-12-15 08:40:54768</p>
769</li>
770<li>
771<p>
Junio C Hamano9d971152012-12-19 00:43:11772<code>size</code> counts the number of bytes left in the <code>buffer</code>.
Junio C Hamano3dac5042007-12-15 08:40:54773</p>
774</li>
775<li>
776<p>
Junio C Hamano9d971152012-12-19 00:43:11777<code>entry</code> points to the current entry being visited.
Junio C Hamano3dac5042007-12-15 08:40:54778</p>
779</li>
Junio C Hamano4604fe52008-09-19 06:37:10780</ul></div>
Junio C Hamanofd9274d2009-08-05 21:21:39781</dd>
Junio C Hamano103b5722011-01-31 05:03:45782<dt class="hdlist1">
Junio C Hamano9d971152012-12-19 00:43:11783<code>struct traverse_info</code>
Junio C Hamanofd9274d2009-08-05 21:21:39784</dt>
785<dd>
786<p>
787 A structure used to maintain the state of a traversal.
788</p>
Junio C Hamano103b5722011-01-31 05:03:45789<div class="ulist"><ul>
Junio C Hamanofd9274d2009-08-05 21:21:39790<li>
791<p>
Junio C Hamano9d971152012-12-19 00:43:11792<code>prev</code> points to the traverse_info which was used to descend into the
793current tree. If this is the top-level tree <code>prev</code> will point to
Junio C Hamanofd9274d2009-08-05 21:21:39794a dummy traverse_info.
795</p>
796</li>
797<li>
798<p>
Junio C Hamano9d971152012-12-19 00:43:11799<code>name</code> is the entry for the current tree (if the tree is a subtree).
Junio C Hamanofd9274d2009-08-05 21:21:39800</p>
801</li>
802<li>
803<p>
Junio C Hamano9d971152012-12-19 00:43:11804<code>pathlen</code> is the length of the full path for the current tree.
Junio C Hamanofd9274d2009-08-05 21:21:39805</p>
806</li>
807<li>
808<p>
Junio C Hamano9d971152012-12-19 00:43:11809<code>conflicts</code> can be used by callbacks to maintain directory-file conflicts.
Junio C Hamanofd9274d2009-08-05 21:21:39810</p>
811</li>
812<li>
813<p>
Junio C Hamano9d971152012-12-19 00:43:11814<code>fn</code> is a callback called for each entry in the tree. See Traversing for more
Junio C Hamanofd9274d2009-08-05 21:21:39815information.
816</p>
817</li>
818<li>
819<p>
Junio C Hamano9d971152012-12-19 00:43:11820<code>data</code> can be anything the <code>fn</code> callback would want to use.
Junio C Hamanofd9274d2009-08-05 21:21:39821</p>
822</li>
Junio C Hamano53ba6d02010-08-22 07:25:12823<li>
824<p>
Junio C Hamano9d971152012-12-19 00:43:11825<code>show_all_errors</code> tells whether to stop at the first error or not.
Junio C Hamano53ba6d02010-08-22 07:25:12826</p>
827</li>
Junio C Hamanofd9274d2009-08-05 21:21:39828</ul></div>
829</dd>
830</dl></div>
Junio C Hamano3dac5042007-12-15 08:40:54831</div>
Junio C Hamano9d971152012-12-19 00:43:11832</div>
833<div class="sect1">
Junio C Hamanofd9274d2009-08-05 21:21:39834<h2 id="_initializing">Initializing</h2>
835<div class="sectionbody">
Junio C Hamano103b5722011-01-31 05:03:45836<div class="dlist"><dl>
837<dt class="hdlist1">
Junio C Hamano9d971152012-12-19 00:43:11838<code>init_tree_desc</code>
Junio C Hamanofd9274d2009-08-05 21:21:39839</dt>
840<dd>
841<p>
Junio C Hamano9d971152012-12-19 00:43:11842 Initialize a <code>tree_desc</code> and decode its first entry. The buffer and
Junio C Hamanofd9274d2009-08-05 21:21:39843 size parameters are assumed to be the same as the buffer and size
Junio C Hamano9d971152012-12-19 00:43:11844 members of <code>struct tree</code>.
Junio C Hamanofd9274d2009-08-05 21:21:39845</p>
846</dd>
Junio C Hamano103b5722011-01-31 05:03:45847<dt class="hdlist1">
Junio C Hamano9d971152012-12-19 00:43:11848<code>fill_tree_descriptor</code>
Junio C Hamanofd9274d2009-08-05 21:21:39849</dt>
850<dd>
851<p>
Junio C Hamano9d971152012-12-19 00:43:11852 Initialize a <code>tree_desc</code> and decode its first entry given the sha1 of
853 a tree. Returns the <code>buffer</code> member if the sha1 is a valid tree
Junio C Hamanofd9274d2009-08-05 21:21:39854 identifier and NULL otherwise.
855</p>
856</dd>
Junio C Hamano103b5722011-01-31 05:03:45857<dt class="hdlist1">
Junio C Hamano9d971152012-12-19 00:43:11858<code>setup_traverse_info</code>
Junio C Hamanofd9274d2009-08-05 21:21:39859</dt>
860<dd>
861<p>
Junio C Hamano9d971152012-12-19 00:43:11862 Initialize a <code>traverse_info</code> given the pathname of the tree to start
863 traversing from. The <code>base</code> argument is assumed to be the <code>path</code>
864 member of the <code>name_entry</code> being recursed into unless the tree is a
Junio C Hamanofd9274d2009-08-05 21:21:39865 top-level tree in which case the empty string ("") is used.
866</p>
867</dd>
868</dl></div>
869</div>
Junio C Hamano9d971152012-12-19 00:43:11870</div>
871<div class="sect1">
Junio C Hamanofd9274d2009-08-05 21:21:39872<h2 id="_walking">Walking</h2>
873<div class="sectionbody">
Junio C Hamano103b5722011-01-31 05:03:45874<div class="dlist"><dl>
875<dt class="hdlist1">
Junio C Hamano9d971152012-12-19 00:43:11876<code>tree_entry</code>
Junio C Hamanofd9274d2009-08-05 21:21:39877</dt>
878<dd>
879<p>
880 Visit the next entry in a tree. Returns 1 when there are more entries
881 left to visit and 0 when all entries have been visited. This is
882 commonly used in the test of a while loop.
883</p>
884</dd>
Junio C Hamano103b5722011-01-31 05:03:45885<dt class="hdlist1">
Junio C Hamano9d971152012-12-19 00:43:11886<code>tree_entry_len</code>
Junio C Hamanofd9274d2009-08-05 21:21:39887</dt>
888<dd>
889<p>
Junio C Hamano103b5722011-01-31 05:03:45890 Calculate the length of a tree entry&#8217;s pathname. This utilizes the
Junio C Hamanofd9274d2009-08-05 21:21:39891 memory structure of a tree entry to avoid the overhead of using a
892 generic strlen().
893</p>
894</dd>
Junio C Hamano103b5722011-01-31 05:03:45895<dt class="hdlist1">
Junio C Hamano9d971152012-12-19 00:43:11896<code>update_tree_entry</code>
Junio C Hamanofd9274d2009-08-05 21:21:39897</dt>
898<dd>
899<p>
900 Walk to the next entry in a tree. This is commonly used in conjunction
Junio C Hamano9d971152012-12-19 00:43:11901 with <code>tree_entry_extract</code> to inspect the current entry.
Junio C Hamanofd9274d2009-08-05 21:21:39902</p>
903</dd>
Junio C Hamano103b5722011-01-31 05:03:45904<dt class="hdlist1">
Junio C Hamano9d971152012-12-19 00:43:11905<code>tree_entry_extract</code>
Junio C Hamanofd9274d2009-08-05 21:21:39906</dt>
907<dd>
908<p>
909 Decode the entry currently being visited (the one pointed to by
Junio C Hamano9d971152012-12-19 00:43:11910 <code>tree_desc's</code> <code>entry</code> member) and return the sha1 of the entry. The
911 <code>pathp</code> and <code>modep</code> arguments are set to the entry&#8217;s pathname and mode
Junio C Hamanofd9274d2009-08-05 21:21:39912 respectively.
913</p>
914</dd>
Junio C Hamano103b5722011-01-31 05:03:45915<dt class="hdlist1">
Junio C Hamano9d971152012-12-19 00:43:11916<code>get_tree_entry</code>
Junio C Hamanofd9274d2009-08-05 21:21:39917</dt>
918<dd>
919<p>
920 Find an entry in a tree given a pathname and the sha1 of a tree to
921 search. Returns 0 if the entry is found and -1 otherwise. The third
Junio C Hamano103b5722011-01-31 05:03:45922 and fourth parameters are set to the entry&#8217;s sha1 and mode
Junio C Hamanofd9274d2009-08-05 21:21:39923 respectively.
924</p>
925</dd>
926</dl></div>
927</div>
Junio C Hamano9d971152012-12-19 00:43:11928</div>
929<div class="sect1">
Junio C Hamanofd9274d2009-08-05 21:21:39930<h2 id="_traversing">Traversing</h2>
931<div class="sectionbody">
Junio C Hamano103b5722011-01-31 05:03:45932<div class="dlist"><dl>
933<dt class="hdlist1">
Junio C Hamano9d971152012-12-19 00:43:11934<code>traverse_trees</code>
Junio C Hamanofd9274d2009-08-05 21:21:39935</dt>
936<dd>
937<p>
Junio C Hamano9d971152012-12-19 00:43:11938 Traverse <code>n</code> number of trees in parallel. The <code>fn</code> callback member of
939 <code>traverse_info</code> is called once for each tree entry.
Junio C Hamanofd9274d2009-08-05 21:21:39940</p>
941</dd>
Junio C Hamano103b5722011-01-31 05:03:45942<dt class="hdlist1">
Junio C Hamano9d971152012-12-19 00:43:11943<code>traverse_callback_t</code>
Junio C Hamanofd9274d2009-08-05 21:21:39944</dt>
945<dd>
946<p>
947 The arguments passed to the traverse callback are as follows:
948</p>
Junio C Hamano103b5722011-01-31 05:03:45949<div class="ulist"><ul>
Junio C Hamanofd9274d2009-08-05 21:21:39950<li>
951<p>
Junio C Hamano9d971152012-12-19 00:43:11952<code>n</code> counts the number of trees being traversed.
Junio C Hamanofd9274d2009-08-05 21:21:39953</p>
954</li>
955<li>
956<p>
Junio C Hamano9d971152012-12-19 00:43:11957<code>mask</code> has its nth bit set if something exists in the nth entry.
Junio C Hamanofd9274d2009-08-05 21:21:39958</p>
959</li>
960<li>
961<p>
Junio C Hamano9d971152012-12-19 00:43:11962<code>dirmask</code> has its nth bit set if the nth tree&#8217;s entry is a directory.
Junio C Hamanofd9274d2009-08-05 21:21:39963</p>
964</li>
965<li>
966<p>
Junio C Hamano9d971152012-12-19 00:43:11967<code>entry</code> is an array of size <code>n</code> where the nth entry is from the nth tree.
Junio C Hamanofd9274d2009-08-05 21:21:39968</p>
969</li>
970<li>
971<p>
Junio C Hamano9d971152012-12-19 00:43:11972<code>info</code> maintains the state of the traversal.
Junio C Hamanofd9274d2009-08-05 21:21:39973</p>
974</li>
975</ul></div>
Junio C Hamano103b5722011-01-31 05:03:45976<div class="paragraph"><p>Returning a negative value will terminate the traversal. Otherwise the
Junio C Hamanofd9274d2009-08-05 21:21:39977return value is treated as an update mask. If the nth bit is set the nth tree
978will be updated and if the bit is not set the nth tree entry will be the
979same in the next callback invocation.</p></div>
980</dd>
Junio C Hamano103b5722011-01-31 05:03:45981<dt class="hdlist1">
Junio C Hamano9d971152012-12-19 00:43:11982<code>make_traverse_path</code>
Junio C Hamanofd9274d2009-08-05 21:21:39983</dt>
984<dd>
985<p>
986 Generate the full pathname of a tree entry based from the root of the
987 traversal. For example, if the traversal has recursed into another
988 tree named "bar" the pathname of an entry "baz" in the "bar"
989 tree would be "bar/baz".
990</p>
991</dd>
Junio C Hamano103b5722011-01-31 05:03:45992<dt class="hdlist1">
Junio C Hamano9d971152012-12-19 00:43:11993<code>traverse_path_len</code>
Junio C Hamanofd9274d2009-08-05 21:21:39994</dt>
995<dd>
996<p>
Junio C Hamano9d971152012-12-19 00:43:11997 Calculate the length of a pathname returned by <code>make_traverse_path</code>.
Junio C Hamanofd9274d2009-08-05 21:21:39998 This utilizes the memory structure of a tree entry to avoid the
999 overhead of using a generic strlen().
1000</p>
1001</dd>
1002</dl></div>
1003</div>
Junio C Hamano9d971152012-12-19 00:43:111004</div>
1005<div class="sect1">
Junio C Hamanofd9274d2009-08-05 21:21:391006<h2 id="_authors">Authors</h2>
1007<div class="sectionbody">
Junio C Hamano103b5722011-01-31 05:03:451008<div class="paragraph"><p>Written by Junio C Hamano &lt;<a href="mailto:gitster@pobox.com">gitster@pobox.com</a>&gt; and Linus Torvalds
1009&lt;<a href="mailto:torvalds@linux-foundation.org">torvalds@linux-foundation.org</a>&gt;</p></div>
Junio C Hamano3dac5042007-12-15 08:40:541010</div>
Junio C Hamano7bd050f2011-09-22 06:32:221011</div>
Junio C Hamano9d971152012-12-19 00:43:111012</div>
Junio C Hamano7bd050f2011-09-22 06:32:221013<div id="footnotes"><hr /></div>
Junio C Hamano3dac5042007-12-15 08:40:541014<div id="footer">
1015<div id="footer-text">
Junio C Hamano9d971152012-12-19 00:43:111016Last updated 2011-11-15 13:45:02 PST
Junio C Hamano3dac5042007-12-15 08:40:541017</div>
1018</div>
1019</body>
1020</html>